layui.use(['form','layer','jquery'],function(){
	var form = layui.form;
	var layer = layui.layer;
	var $ = layui.jquery;
	
	$(".layui-btn-primary").click(function() {
		location.href="registe";
	})
	
	//监听提交
	  form.on('submit(loginForm)', function(data){
		  $.post('login',data.field,function(resp){
			  console.log(resp);
			  if(resp){
					layer.msg('登录成功',{icon:1,time:1000},function(){
						location.href='indexs';	
					});
				}else{
					alert('用户或密码错误');
					$('input[name="userCode"]').val("");
					$('input[name="password"]').val("");
					$('input[name="userCode"]').focus();
				}
				
			},'json');
		  
	    return false;
	  });
	
});
	
	
	
	
